repo: Ensure we set mode for bare-user files before xattrs
authorColin Walters <walters@verbum.org>
Tue, 12 Jul 2016 13:43:32 +0000 (09:43 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 12 Jul 2016 14:09:37 +0000 (14:09 +0000)
commitf45eca948c98c57965dd9cf703f46f2ae405e349
tree111ca18a44d078ca6a3a5bac5d1965e88f27c537
parent87c9e227cb84b8c720a41bc228beeb1b6f9b09c4
repo: Ensure we set mode for bare-user files before xattrs

When trying to switch ostree to `O_TMPFILE`, I hit the fact that
by default it uses mode `000`.  It still works to write to the
open fd of course, but it *doesn't* work to set xattrs because
that code path for some reason in the kernel checks the mode bits.

This only broke for bare-user repos where we tried to set the xattr
before calling `fchmod()`, so just invert those two operations.

Closes: #391
Approved by: jlebon
src/libostree/ostree-repo-commit.c